/*
 * BinaryMulOperatorAst.cpp
 *
 *  Created on: 30 Oct 2010
 *      Author: kn308
 */

#include <MAlice/Ast/BinaryMulOperatorAst.h>

namespace MAlice
{

BinaryMulOperatorAst::BinaryMulOperatorAst(ExpressionAst* lhs,
		ExpressionAst* rhs) :
	BinaryOperatorAst("*", lhs, rhs)
{
}

BinaryMulOperatorAst::~BinaryMulOperatorAst()
{
}

llvm::Value* BinaryMulOperatorAst::generate()
{
	llvm::Value* LHS = getLHS()->generate();
	llvm::Value* RHS = getRHS()->generate();

	checkType(LHS, RHS);

	llvm::IRBuilder<>* builder = MAlice::Codegen::get()->getBuilder();

	return builder->CreateMul(LHS, RHS);
}

}
